import user.AdminUser;
import user.NormalUser;
import user.ProxyUser;
import user.User;
import user.factory.AdminUserFactory;
import user.factory.IUserFactory;
import user.factory.NormalUserFactory;

public class LibrarySystem {
    public static void main(String[] args) {
        //工厂模式高效，修改容易
        IUserFactory adminUserFactory =new AdminUserFactory();
        User adminUser=adminUserFactory.createUser("刘备",1);
        IUserFactory normalUserFactory=new NormalUserFactory();
        User normalUser1=normalUserFactory.createUser("关羽",2);
        User normalUser2=normalUserFactory.createUser("张飞",3);
        //使用代理模式来控制对象的访问
       ProxyUser proxyUserAdmin= new ProxyUser(adminUser);
        ProxyUser proxyUserNormalG= new ProxyUser(normalUser1);
        ProxyUser proxyUserNormalZ= new ProxyUser(normalUser2);
    }
    public static void main1(String[] args) {
        //直接创建管理员用户
        User adminUser=new AdminUser("刘备",1);
        //直接创建普通用户
        User normalUser1=new NormalUser("关羽",2);
        User normalUser2=new NormalUser("张飞",3);
        //这种模式不高效，修改代码较为复杂
    }
}
